package cn.codelab.seata.order.service.impl;

import cn.codelab.seata.order.mapper.OrderMapper;
import cn.codelab.seata.order.service.OrderService;
import cn.codelab.seata.order.entity.Order;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Seven
 * @description
 * @博客：https://codelab7.cn
 * @Gitee https://gitee.com/it-codelab
 * @Copyright 公众号：Seven的代码实验室
 */
@Slf4j
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean create(Order order) {
        log.info("创建订单开始");
        int index = this.baseMapper.insert(order);
        log.info("创建订单结束");
        return index > 0;
    }
}
